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