UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '51sXhR5n5QEldaf3iWiNZODZ7KFbzDHnL1axJHhA6uE='
WHERE
key_id = 'b3fd6b8b34b2e2fb19fe128f4ae8a83f5ad6eaae46460dbb8c4204ae6ca48c83'
AND (
token = '51sXhR5n5QEldaf3iWiNZODZ7KFbzDHnL1axJHhA6uE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)