UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'n6xF6GlkOovA7v2yRAWM+Gd4GGVRqI5FAIFpuFGjCQY='
WHERE
key_id = 'cb50b74cc37f0a8a172d0abfe6b451c1e2f2c26b59137b7b67d01f5b82d68e5e'
AND (
token = 'n6xF6GlkOovA7v2yRAWM+Gd4GGVRqI5FAIFpuFGjCQY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)