UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '1nPDk54IBZrl6wAdmOuX1vbUMRGi8qXBbxMxTsHBlZ4=' 
WHERE 
  key_id = '468c3c4a808a28f6db16e86258b0c23bb99d1b46a99b736cfbe5f865177679ee' 
  AND (
    token = '1nPDk54IBZrl6wAdmOuX1vbUMRGi8qXBbxMxTsHBlZ4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043