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