UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'aiYC+PQSafGdDZpUMJ17l/4qh0HAqPCj0l+yV7SbZ/8='
WHERE
key_id = '9e698fe79faa9391e2df4681177b1a7db5c2bc4beffc4ffc383e9742a221b5ef'
AND (
token = 'aiYC+PQSafGdDZpUMJ17l/4qh0HAqPCj0l+yV7SbZ/8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)