UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Nri/bb2TuWRMMYzCRbdsqCSB9Zka/QcOfPiiIwd9H3U='
WHERE
key_id = '7b738a7e77f6531f72acb0f8def94a4d87970b7451331efb9b097707ff0d4013'
AND (
token = 'Nri/bb2TuWRMMYzCRbdsqCSB9Zka/QcOfPiiIwd9H3U='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)