UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'b/OLIqydcQx9YuO8IdxakVt6L3UwOm3f2XNYMT6lE9k='
WHERE
key_id = 'd9f82eed7ff0488a9a7e9f3e3c8705dc84e572f9a33c9d786c5556f1f95e7ebb'
AND (
token = 'b/OLIqydcQx9YuO8IdxakVt6L3UwOm3f2XNYMT6lE9k='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)