UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0E7THY5dYa+bjAaTcXzZUeSfHyP+e+jg/7BOC7/FaGw=' 
WHERE 
  key_id = '45b0f003d49d137373efc9b8d379a9d4080d94d393bc334d18124e2ae122959f' 
  AND (
    token = '0E7THY5dYa+bjAaTcXzZUeSfHyP+e+jg/7BOC7/FaGw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034