UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'N2GwW5twww1hNsPIH5QnYOabRJcEqRqlN/wdxPfM4HM='
WHERE
key_id = 'a72cbd5592e4e57c34d1c9385730e8f24e94f8b6fffd9c0f86e58c289e4b8898'
AND (
token = 'N2GwW5twww1hNsPIH5QnYOabRJcEqRqlN/wdxPfM4HM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)