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