UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BJ77wFUj+g1+02lMDeHZtRkNw1hX/gKxMaKHNvLEQSo=' 
WHERE 
  key_id = '888bf2e0964daac2e5eb868143a84291003ed79ce6920eba21473372f575b081' 
  AND (
    token = 'BJ77wFUj+g1+02lMDeHZtRkNw1hX/gKxMaKHNvLEQSo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044