UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'FqN9OTEajLSPzPAAFFeWc0YiwdrLqGWmrmbEgcSKexA='
WHERE
key_id = '514e57103cc3c96a039174d7cf5114be6167479bb4837d6f5fb4546d3289ebd5'
AND (
token = 'FqN9OTEajLSPzPAAFFeWc0YiwdrLqGWmrmbEgcSKexA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)