UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'OUiNqpjzLMi1QbnL0GyzjpMKpD66+WDW8oxV3idw3M8='
WHERE
key_id = '2a163b575001f81b0dbae3eb473b3928bfe54145d7e4e7ff9694be37eb326a9e'
AND (
token = 'OUiNqpjzLMi1QbnL0GyzjpMKpD66+WDW8oxV3idw3M8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)