UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'xPqosmZalmthgw5HJKb6t8dYgauYdlHApx91tGSKcNY='
WHERE
key_id = 'b6fa86fa4411a95d059438918043625fedf6d97788dc65ca7017748ba6a9511b'
AND (
token = 'xPqosmZalmthgw5HJKb6t8dYgauYdlHApx91tGSKcNY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)