UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'pDQp5I8qpS5+fc2a5XOKrIfM39lKlAe2Ewrv3LjK5nQ='
WHERE
key_id = '89dfa7e21c4106edebb285e8f59cc429610cc301e01c93fad252d37f54d3a199'
AND (
token = 'pDQp5I8qpS5+fc2a5XOKrIfM39lKlAe2Ewrv3LjK5nQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)