UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '5C0LN0vKPCkoCsIRkL/asLqmQoN4wgA7iIQw3OMrVwI='
WHERE
key_id = '2a39273baffc3f8561e11803a3e3e27b5fb3c3e87542db692c5ec3266f6666f9'
AND (
token = '5C0LN0vKPCkoCsIRkL/asLqmQoN4wgA7iIQw3OMrVwI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)