UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'QX54xO5QCo23GqX3XUPIINOQwhFi/dy8j+2Ymbx1g64='
WHERE
key_id = 'c8eefe240dd1a1e4dd637e12ec7b20a0ad9a05e639f458c88c9c127d61dfe1ef'
AND (
token = 'QX54xO5QCo23GqX3XUPIINOQwhFi/dy8j+2Ymbx1g64='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)