UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'QWafI/meDBz0iMx7RE6H9l8di81KLb32a7ElHWZJbwU='
WHERE
key_id = '3b85a8cb86e9e94f3fa117de1282111616c38ab86621a0c7cb306a96c84f9f6a'
AND (
token = 'QWafI/meDBz0iMx7RE6H9l8di81KLb32a7ElHWZJbwU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)