UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '9cdORVjkDNDU6hyMPMHILaf0tco6n9H6Bgyff1Yl9JI='
WHERE
key_id = 'd8167f8bd3b3710a12a60ac9db1470dbd7b582665f67035ce4f6f89bdc7009f7'
AND (
token = '9cdORVjkDNDU6hyMPMHILaf0tco6n9H6Bgyff1Yl9JI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)