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

Query time 0.00036