UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qkNnQYIyQWPGMnqX3XRy3a9glRVqzAfzPKWoKwhNdnA='
WHERE
key_id = '35474f874229d0003433514b9f9b170707c2563ab858dfd5abf347d2ca98aa45'
AND (
token = 'qkNnQYIyQWPGMnqX3XRy3a9glRVqzAfzPKWoKwhNdnA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)