UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'AJLUZB59iroisueu/IvpmtxgK4FV6UzMhVG6TlyufU0=' 
WHERE 
  key_id = '3480e0cb2cef693d640f5b09892e8511c8eecc80c4990c92ae077d2d2c671814' 
  AND (
    token = 'AJLUZB59iroisueu/IvpmtxgK4FV6UzMhVG6TlyufU0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019