UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'c2L9GV3ko3E/XU5VLXis/O+d441ImvCWTc77+8/l2vs=' 
WHERE 
  key_id = '099de6d2f8e445efd75dce309d6a39557c215e82cd1a4766147e3ef956432c96' 
  AND (
    token = 'c2L9GV3ko3E/XU5VLXis/O+d441ImvCWTc77+8/l2vs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023