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