UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KaZEyvrMritBmnX/sK+gu2Qjrgyy8FTWjBD5XSIPEqM='
WHERE
key_id = '58b953c7a5c5162d5a46a6a6266fb9a428b85e896678f464995a3d76742bbcae'
AND (
token = 'KaZEyvrMritBmnX/sK+gu2Qjrgyy8FTWjBD5XSIPEqM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)