UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '5O1vpYQyHxvuxKmH0ojCmOElvd8++nYOC7/HpSZIzA4='
WHERE
key_id = '45e058e7e0c0238e61c23b164ae05991c63c5e0becc02b10cbb67089a66323bd'
AND (
token = '5O1vpYQyHxvuxKmH0ojCmOElvd8++nYOC7/HpSZIzA4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)