UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'L44N2RYRyYiSMK60K2FduleawuMYrI7J3aINNo2t3Hs=' 
WHERE 
  key_id = 'c13a0833e7f929701f74d2d73f0989e5c768ba73cca39cff09d21df946d090fd' 
  AND (
    token = 'L44N2RYRyYiSMK60K2FduleawuMYrI7J3aINNo2t3Hs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030