UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'QdM3HxMUnjTZ4ci9IXF9V0hhWU9IbzuGmj5LhEDh+A4='
WHERE
key_id = '8d23b72393806c5cc9614d15e91e74554293a4a115303fb918ae348cd49a3740'
AND (
token = 'QdM3HxMUnjTZ4ci9IXF9V0hhWU9IbzuGmj5LhEDh+A4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)