UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'q4TUFSGLzwUaRlDI9MZD5CU2FsNqkZ6Sc9g4cdwvsdg='
WHERE
key_id = '87f1ae9ecd9ee015420637f44345f22aa389e45a6070197cbd617b689325be7c'
AND (
token = 'q4TUFSGLzwUaRlDI9MZD5CU2FsNqkZ6Sc9g4cdwvsdg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)