UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'M7IpdUQUq9zxBbbiXzr7gg2dKvmNH+aLtsaNU1fGeT8=' 
WHERE 
  key_id = '17d503969cb534af5caa536f1b64da7a06f3715b7f8ce2fc2e6efaa52c4e4f7c' 
  AND (
    token = 'M7IpdUQUq9zxBbbiXzr7gg2dKvmNH+aLtsaNU1fGeT8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00015