UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dGBgi0FvKU1iO2nfrRs5LpCYzmt/RXgp//MAMFVPSnE=' 
WHERE 
  key_id = '64016aac3dde5b231d9a74c17b287c29bc4f2e370e61bf1bcd4b3e446f49d298' 
  AND (
    token = 'dGBgi0FvKU1iO2nfrRs5LpCYzmt/RXgp//MAMFVPSnE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040