UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fXWyv7CA+mUDcaX4mN82P6aqJlYhTol2qEc8GduBs8M=' 
WHERE 
  key_id = '159bfdadc5b142490ee6776ffd36c687d1684573e348b57b174a4f0682857395' 
  AND (
    token = 'fXWyv7CA+mUDcaX4mN82P6aqJlYhTol2qEc8GduBs8M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00015